<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<link rel="stylesheet" href="css/bootstrap.css" />
	<link rel="stylesheet" href="wall.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<title>文件共享</title>
	<style type="text/css">
		body{
			background-image:url(img/scribble_light.png);
		}
		#form{
			margin-left:150px;
		}
	</style>
</head>
<body>
	<div class="navbar">
		<div class="navbar-inner">
			<div class="container">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
				  <span class="icon-bar"></span>
				  <span class="icon-bar"></span>
				  <span class="icon-bar"></span>
				</a>
				<a class="brand" href="#" style="margin-left:50px">${projectname }</a>
				<div class="nav-collapse">
				  <ul class="nav">
					<li><a href="main.jspx">最新动态</a></li>
					<li><a href="goal.jspx">目标</a></li>
					<li><a href="document.jspx">资料库</a></li>
					<li class="active"><a href="filetype.jspx">文件共享</a></li>
					<li><a href="person.jspx">联系人</a></li>
					<li><a href="idea.jspx">想法</a></li>
					<li><a href="#">Bug</a></li>
					<li><a href="#">项目设置</a></li>					
				  </ul>					
				</div>
			</div>
		</div>
	</div>
	<div class="container" id="form">
	    <div class="row">
			<div class="first">
				<div class="span6">				
					<h2>文件共享</h2>						
				</div>				
			</div>
		</div>
		<div class="row">
			<div class="span9">
				<ul class="breadcrumb">
					<li class="active">
						<a href="#"><i class="icon-folder-open"></i>文件列表 </a>
					</li>
					
				</ul>
				<table class="table table-striped">
					<tr>
						<th></th>
						<th>名称</th>
						<th>大小</th>
						<th>创建人</th>
						<th></th>
					</tr>
					<c:forEach items="${requestScope.sharefile }" var="f">
						<tr>
							<td><img src="img/file.png"/></td>
							<td><a href="#">${f.name }</a></td>
							<td>${f.filesize }M</td>
							<td>${user.username }</td>
							<td>
								<a title="删除" class="del_link" rel="${f.id }" href="javascript:;"><i class="icon-trash"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="file.jspx?_m=down" title="下载"><i class="icon-pencil"></i></a>
							</td>
						</tr>
					</c:forEach>
				</table>
				<ul>
					<li style="float:right">
						<form action="file.jspx?_m=new_fileUpload" method="post" enctype="multipart/form-data">
							<input type="file" name="doc"/><br/>
	    					<i class="icon-plus"></i><input class="btn btn-primary" type="submit" value="上传文件"/>
	    					<input type="hidden" name="username" value="${user.username }">
	    					<input type="hidden" name="userid" value="${user.id }">
	    					<input type="hidden" name="filetypeid" value="${filetype.id }">
	    					
						</form>				
					</li>
				</ul>
			</div>
		</div>
	</div>
	<script type="text/javascript">
    	$(document).ready(function(){
    		$(".del_link").click(function(){
    			var id = $(this).attr("rel");
    			if(confirm("确定要删除此数据？")) {
					window.location.href = "file.jspx?_m=del&id=" + id;
    			}
    			
    		});
    		
    	});
    	
    </script> 
</body>
</html>